package com.langerra.shared.channel;

import java.io.Serializable;
import java.util.Collection;

public interface OutputChannel<T extends Serializable>
		extends AbstractChannel {

	// write a reference of the message
	// use full for fan-out processes
	void write(
			ChannelMessage<T> message);

	/**
	 * write a message to the channel
	 * 
	 * @param message
	 *          the message to be written
	 * @return a message identifier
	 * */
	long write(
			T message);

	/**
	 * write all of the messages to the channel
	 * 
	 * @param the
	 *          collection of message to write
	 * 
	 * @return true if all message were successfully written to the channel
	 * */
	void writeAll(
			Collection<? extends T> messages);
}
